<!--<div class="wide form">-->
<?php //$form=$this->beginWidget('CActiveForm', array(
	//'action'=>Yii::app()->createUrl($this->route),
	//'method'=>'post',
//)); ?>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'search_form',
)); ?>
<fieldset class="classFieldSet">
    <legend>Tìm lớp</legend>
<table>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Mã lớp'); ?></td>
        <td class="dataInput"><input type="text" name="id_course" size="10"></td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Tên phụ huynh'); ?></td>
        <td class="dataInput"><input type="text" name="parent_name" size="20"></td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Di động'); ?></td>
        <td class="dataInput"><input type="text" name="cell_phone" size="20"></td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('ĐT bàn'); ?></td>
        <td class="dataInput"><input type="text" name="table_phone" size="20"></td>
    </tr>
    <tr>
                <td class="titleInput">
                    <?php echo CHtml::encode('Địa chỉ'); ?>
                </td>
                <td class="dataInput">
                    <input type="text" name="home_number" size="10">
                    <input type="text" name="street" size="30">
                    <?php $districts = District::model()->findAll(array('order'=>'id'));?>
                    <select name="id_district">
                        <?php foreach ($districts as $district) {?>
                        <option value="<?php echo $district->id;?>"><?php echo $district->name;?></option>
                        <?php } ?>
                    </select>
                </td>
    </tr>
    <tr>
        <td class="titleInput">
            <?php echo CHtml::encode('Hạn ngày'); ?>
        </td>
        <td>
             <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                            'name'=>'limit_date',
                            'attribute'=>'limit_date',
                            // additional javascript options for the date picker plugin
                            'options'=>array(
                                'showAnim'=>'fold',
                                'dateFormat'=>'yy-mm-dd',
                            ),
                            'htmlOptions'=>array(
                                'style'=>'height:20px;'
                            ),
                            ));
                    ?>
        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Lớp'); ?></td>
        <?php 
            $level_list = Level::model()->findAll();
            $level_num  = count($level_list);
            $col_num = $level_num/4;
            if(($level_num%4) != 0) {
                $col_num+=1;
            }
            $pointer = 0;
        ?>
        <td class="dataInput">
            <table>
               
                <tr>
                    <input type="checkbox" name="level_list[]" value="0" checked="true" style="display: none"/>
                    <?php for($i=0; $i < 4; $i++) {?>
                    <td>
                        
                        <?php
                            $level_list = Level::model()->findAll(array('limit'=>$col_num, 'offset'=>$pointer, 'order'=>'id'));
                            foreach ($level_list as $level) {
                             ?>
                        <input type="checkbox" name="level_list[]" value="<?php echo $level->id;?>"><?php echo $level->name;?><br>
                        <?php } ?>
                    </td>
                    <?php
                        $pointer+=$col_num;
                    }
                    ?>
                </tr>
            </table>

        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Quận'); ?></td>
        <?php
            $district_list = District::model()->findAll();
            $district_num  = count($district_list);
            $row_num = $district_num/4;
            if(($district_num%4) != 0) {
                $row_num+=1;
            }
            $pointer = 0;

        ?>
        <td class="dataInput">
            <table>
                <tr>
                    <input type="checkbox" name="district_list[]" value="0" checked="true" style="display: none"/>
                    <?php for($i=0; $i < 4; $i++) {?>
                    <td>
                        
                        <?php
                            $district_list = District::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                            foreach ($district_list as $district) {
                        ?>
                            <input type="checkbox" name="district_list[]" value="<?php echo $district->id;?>"><?php echo $district->name;?><br>
                        <?php } ?>
                    </td>
                    <?php 
                        $pointer+=$row_num;
                    }
                    ?>
                </tr>
            </table>

        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Môn học'); ?></td>
        <?php
            $subject_list = Subject::model()->findAll();
            $subject_num  = count($subject_list);
            $row_num = $subject_num/4;
            if(($subject_num%4) != 0) {
                $row_num+=1;
            }
            $pointer = 0;

        ?>
        <td class="dataInput">
            <table>
                <tr>
                    <input type="checkbox" name="subject_list[]" value="0" checked="true" style="display: none"/>
                    <?php for($i=0; $i < 4; $i++) {?>
                    <td>
                        
                        <?php

                            $subject_list = Subject::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                            foreach ($subject_list as $subject) {
                        ?>
                            <input type="checkbox" name="subject_list[]" value="<?php echo $subject->id;?>"><?php echo $subject->name;?><br>
                        <?php } ?>
                    </td>
                    <?php 
                        $pointer+=$row_num;
                    }
                   ?>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Trạng thái'); ?></td>
        <td class="dataInput">
            <input type="radio" name="status" value="0"/>Chưa giao
            <input type="radio" name="status" value="1"/>Đã giao
            <input type="radio" name="status" value="2" checked="true"/>Cả hai
        </td>

    </tr>
    <tr>
        <td class="titleInput"> <?php echo CHtml::encode('In ấn'); ?></td>
        <td class="dataInput">
            <input type="radio" name="is_printed" value="0"/>Chưa in
            <input type="radio" name="is_printed" value="1"/>Đã in
            <input type="radio" name="is_printed" value="2" checked="true"/>Cả hai
        </td>
    </tr>
</table>
	<div class="row buttons">
                 <?php
                            echo CHtml::ajaxSubmitButton(
                                'Thống kê',
                                array('course/search'),
                                array(
                                    'update'=>'#result',
                                )
                            );
                        ?>
	</div>

</fieldset>
<?php $this->endWidget(); ?>
<div id="result">
</div>
<!--</div> search-form -->